<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>个人中心</title>
		<link rel="stylesheet" type="text/css" href="../css/personal_center.css" />
	</head>
	<body>
		<nav class="nav">
			<div class="nav_logo">FOG</div>

			<div class="nav_content">
				<div class="nav_content_text">
					<a href="../index.html">首页</a>
				</div>
				
				<div class="nav_content_text">
					<a href="tree_hole.html">树洞</a>
				</div>

				<div class="nav_content_text">
					<a href="personal_center.html">我的</a>
				</div>
					
				<div class="nav_content_text">
					<a href="#" id="logoutLink">退出</a>
				</div>
			</div>
		</nav>
		
		<div class="nav-divider"></div>
		
		<script>
			// 这里从localStorage中获取，与登录功能保持一致
			const currentUser = localStorage.getItem('username') || '123';
			const logoutLink = document.getElementById('logoutLink');
			logoutLink.addEventListener('click', function(e) {
				e.preventDefault();
				const confirmLogout = confirm(`您是否确认退出账户${currentUser}？`);
				if (confirmLogout) {
					localStorage.removeItem('username');
					window.location.href = '../index.html';
				}
			});
		</script>
	</body>
</html>
